package com.fastCms.manager.bim.controller;


import com.fastCms.business.bim.manage.PollutionManageService;
import com.fastCms.business.bim.pojo.po.PollutionAddPO;
import com.fastCms.business.bim.pojo.po.PollutionPO;
import com.fastCms.business.bim.pojo.vo.PollutionVO;
import com.fastCms.business.frame.pojo.PageParam;
import com.fastCms.business.frame.response.ApiResponse;
import com.fastCms.manager.frame.annotation.UserAccess;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 排放源表 前端控制器
 * </p>
 *
 * @author liusq
 * @since 2021-07-07
 */

@RestController
@RequestMapping("/pollution")
@Api(value = "PollutionController", tags = "后端-排放源管理")
@UserAccess
public class PollutionController {

    @Autowired
    private PollutionManageService pollutionManageServiceImpl;

    @ApiOperation(value = "列表", notes = "")
    @PostMapping("/showList")
    public ApiResponse<PageInfo<PollutionVO>> showList(@RequestBody PageParam<PollutionPO> pageParam) {
        ApiResponse<PageInfo<PollutionVO>> detail = pollutionManageServiceImpl.showList(pageParam);
        return detail;
    }

    @ApiOperation(value = "新增或修改", notes = "")
    @PostMapping("/saveOrUpdate")
    public ApiResponse<Boolean> saveOrUpdate(@RequestBody PollutionAddPO pollutionAddPO) {
        ApiResponse<Boolean> detail = pollutionManageServiceImpl.saveOrUpdate(pollutionAddPO);
        return detail;
    }

    @ApiOperation(value = "获取排放源详情", notes = "")
    @GetMapping("/getDetail/{id}")
    public ApiResponse<PollutionVO> getDetail(@PathVariable Integer id) {
        ApiResponse<PollutionVO> detail = pollutionManageServiceImpl.getDetail(id);
        return detail;
    }

    @ApiOperation(value = "删除", notes = "")
    @GetMapping("/delete/{id}")
    public ApiResponse<Boolean> delete(@PathVariable Integer id) {
        ApiResponse<Boolean> detail = pollutionManageServiceImpl.delete(id);
        return detail;
    }

}

